// Tags: Hash, SqrBinaryIndexedTree
#include <cstdio>
#include <cstdlib>
#include <map>
#define lowbit(x) (x & -x)

typedef std::pair<int, int> par;

const int N = 2e3 + 5;
int n, m, q, bit[N][N];
std::map<par, int> map;

inline void modify(int x, int y, int val) {
  for (int i = x; i <= n; i += lowbit(i))
    for (int j = y; j <= m; j += lowbit(j)) bit[i][j] ^= val;
}

inline int query(int x, int y) {
  int res = 0;
  for (int i = x; i; i -= lowbit(i))
    for (int j = y; j; j -= lowbit(j)) res ^= bit[i][j];
  return res;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("z.in", "r", stdin);
  freopen("z.out", "w", stdout);
#endif
#endif

  scanf("%d%d%d", &n, &m, &q);
  srand((unsigned long long)new bool);
  for (int p, x1, y1, x2, y2; q; --q) {
    scanf("%d%d%d%d%d", &p, &x1, &y1, &x2, &y2);
    if (p == 1) {
      int val = rand();
      map[par(x1 * n + y1, x2 * n + y2)] = val;
      modify(x1, y1, val);
      modify(x1, y2 + 1, val);
      modify(x2 + 1, y1, val);
      modify(x2 + 1, y2 + 1, val);
    } else if (p == 2) {
      int val = map[par(x1 * n + y1, x2 * n + y2)];
      modify(x1, y1, val);
      modify(x1, y2 + 1, val);
      modify(x2 + 1, y1, val);
      modify(x2 + 1, y2 + 1, val);
    } else
      puts(query(x2, y2) == query(x1, y1) ? "Yes" : "No");
  }
  return 0;
}